<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>charAt方法返回指定位置的字符，参数从0开始编写</p>
    <script>
        var str = "itbaizhan";
        console.log(str.length);
        console.log(str.charAt(0));
        console.log(str.charAt(5));
        console.log(str.charAt(-1));//负值返回空字符串
        console.log(str.charAt(12));//字符串长度9，超出字符串长度，也是返回空字符串
    </script>
</body>
</html>